import 'dart:typed_data';

import 'package:bluetooth_protocols_plugin/library.dart';

import '../../tools/bit_field.dart';

class V12sSettings extends LorinSettings {
  bool tboxLowBatWakeUp = false; // 云盒低电唤醒功能  0 关闭  1 开启
  bool showTboxInfo = false; // 云盒信息显示开关  0 关闭  1 开启

  V12sSettings.fromBytes(Uint8List bytes) : super.fromBytes(bytes) {
    var byteData = ByteData.sublistView(bytes);
    int bitField = byteData.getUint32(38, Endian.little);
    BitField bit = BitField(bitField);
    tboxLowBatWakeUp = bit[19] == 1;
    showTboxInfo = bit[20] == 1;
  }

  // 将对象转换为Map
  @override
  Map<String, dynamic> toMap() {
    var map = super.toMap(); // 先获取父类的 Map
    map['tboxLowBatWakeUp'] = tboxLowBatWakeUp;
    map['showTboxInfo'] = showTboxInfo;
    map['version'] = '$runtimeType';
    return map;
  }
}
